using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class createUser : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
		if (!Page.IsPostBack)
		{
			PasswordText.Text = Membership.GeneratePassword(12, 3);
		}
    }

	protected void OnCreateUserButtonClick(object sender, EventArgs e)
	{

		MembershipUser newUser = Membership.CreateUser(UserNameText.Text, PasswordText.Text, EmailText.Text);
		Roles.AddUserToRole(newUser.UserName, "Database Owner");
		Roles.AddUserToRole(newUser.UserName, "Membership User");
		StatusLabel.Text = "User has been created and assigned the <b>Membership User</b> and <b>Database Owner</b> roles.  Please use the Membership Administration > Manage Users page to assign this user to other roles.";

	}
}
